@extends('admin.common.web')

@section('title','管理员添加')

@section('content')
<!-- Page Content -->
    <!-- Page Breadcrumb -->
    <div class="page-breadcrumbs">
        <ul class="breadcrumb">
            <li>
                <a href="{{ route('admin.index.index') }}">系统</a>
            </li>
            <li>
                <a href="{{ route('admin.admin.index') }}">管理员管理</a>
            </li>
            <li class="active">添加管理员</li>
        </ul>
    </div>
    <!-- /Page Breadcrumb -->
    <!-- Page Body -->
    <div class="page-body">

        <div class="row">
            <div class="col-lg-12 col-sm-12 col-xs-12">
                <div class="widget">
                    <div class="widget-header bordered-bottom bordered-blue">
                        <span class="widget-caption">新增管理员</span>
                    </div>
                    <div class="widget-body">
                        <div id="horizontal-form">
                            @include('admin.common.msg')
                            @include('admin.common.error')
                            <form class="form-horizontal" action="{{ route('admin.admin.store') }}" method="post" enctype="multipart/form-data">
                                @csrf
                                <div class="form-group">
                                    <label for="username" class="col-sm-2 control-label no-padding-right">昵称</label>
                                    <div class="col-sm-6">
                                        <input class="form-control" value="{{ old('nickname') }}" name="nickname" required type="text">
                                    </div>
                                    @if($errors->has('nickname'))
                                        <p class="help-block col-sm-4 blue">{{ $errors->first('nickname') }}</p>
                                    @else
                                        <p class="help-block col-sm-4 red">* 必填</p>
                                    @endif
                                </div>

                                <div class="form-group">
                                    <label for="username" class="col-sm-2 control-label no-padding-right">用户名</label>
                                    <div class="col-sm-6">
                                        <input class="form-control" value="{{ old('username') }}" name="username" required type="text">
                                    </div>
                                    @if($errors->has('username'))
                                        <p class="help-block col-sm-4 blue">{{ $errors->first('username') }}</p>
                                    @else
                                        <p class="help-block col-sm-4 red">* 必填</p>
                                    @endif
                                </div>

                                <div class="form-group">
                                    <label for="username" class="col-sm-2 control-label no-padding-right">密码</label>
                                    <div class="col-sm-6">
                                        <input class="form-control" value="{{ old('password') }}" name="password" required type="password">
                                    </div>
                                    @if($errors->has('password'))
                                        <p class="help-block col-sm-4 blue">{{ $errors->first('password') }}</p>
                                    @else
                                        <p class="help-block col-sm-4 red">* 必填</p>
                                    @endif
                                </div>

                                <div class="form-group">
                                    <label for="username" class="col-sm-2 control-label no-padding-right">图片</label>
                                    <div class="col-sm-6">
                                        <input class="form-control" value="{{ old('thumb') }}" name="thumb" type="file">
                                    </div>
                                    @if($errors->has('thumb'))
                                        <p class="help-block col-sm-4 blue">{{ $errors->first('thumb') }}</p>
                                    @endif
                                </div>


                                <div class="form-group">
                                    <label for="username" class="col-sm-2 control-label no-padding-right">年龄</label>
                                    <div class="col-sm-6">
                                        <input class="form-control" value="{{ old('age') }}" name="age" type="text">
                                    </div>
                                    @if($errors->has('age'))
                                        <p class="help-block col-sm-4 blue">{{ $errors->first('age') }}</p>
                                    @endif
                                </div>

                                <div class="form-group">
                                    <label for="username" class="col-sm-2 control-label no-padding-right">角色</label>
                                    <div class="col-sm-6">
                                        <div class="checkbox">
                                            @foreach($roles as $v)
                                                <label>
                                                    <input type="checkbox" name="role_id[]" value="{{ $v['id'] }}" class="inverted">
                                                    <span class="text">{{ $v['role_name'] }}</span>
                                                </label>
                                            @endforeach
                                        </div>
                                    </div>
                                    @if($errors->has('role_id'))
                                        <p class="help-block col-sm-4 blue">{{ $errors->first('role_id') }}</p>
                                    @endif
                                </div>

                                <div class="form-group">
                                    <label for="username" class="col-sm-2 control-label no-padding-right">性别</label>
                                    <div class="col-sm-6">
                                        <div class="radio">
                                            <label>
                                                <input name="sex" type="radio" value="0" checked class="inverted">
                                                <span class="text">男</span>
                                            </label>

                                            <label>
                                                <input name="sex" type="radio" value="1" class="inverted">
                                                <span class="text">女</span>
                                            </label>
                                        </div>
                                    </div>
                                    @if($errors->has('sex'))
                                        <p class="help-block col-sm-4 blue">{{ $errors->first('sex') }}</p>
                                    @endif
                                </div>

                                <div class="form-group">
                                    <label for="username" class="col-sm-2 control-label no-padding-right">状态</label>
                                    <div class="col-sm-6">
                                        <div class="radio">
                                            <label>
                                                <input name="status" type="radio" value="1" checked class="colored-blue">
                                                <span class="text">正常</span>
                                            </label>

                                            <label>
                                                <input name="status" type="radio" value="0" class="colored-danger">
                                                <span class="text">锁定</span>
                                            </label>
                                        </div>
                                    </div>
                                    @if($errors->has('status'))
                                        <p class="help-block col-sm-4 blue">{{ $errors->first('status') }}</p>
                                    @endif
                                </div>


                                <div class="form-group">
                                    <div class="col-sm-offset-2 col-sm-10">
                                        <button type="submit" class="btn btn-info">保存信息</button>
                                        <a href="JavaScript:window.history.go(-1);" class="btn btn-default">返回</a>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </div>
    <!-- /Page Body -->
@endsection